import 'package:get/get.dart';
import 'package:kkhousekeep/page/login/login_controller.dart';
import 'package:kkhousekeep/tools/shared_preferences.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';

class AboutController extends GetxController {
  var userType = UserType.owner.obs;
  var appName = "".obs;
  var versionName = "".obs;

  @override
  void onInit() {
    super.onInit();
    SharedPreferences.getInstance()
        .getUserType()
        .then((value) => userType.value = value);
    getVersionInfo();
  }

  void getVersionInfo() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    appName.value = packageInfo.appName;
    versionName.value = "V${packageInfo.version}";
  }
}
